<?php

/**
 * Video form base class.
 *
 * @method Video getObject() Returns the current form's model object
 *
 * @package    iEasy
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseVideoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'video_id'            => new sfWidgetFormInputHidden(),
      'title'               => new sfWidgetFormTextarea(),
      'artist'              => new sfWidgetFormInputText(),
      'source'              => new sfWidgetFormTextarea(),
      'tag'                 => new sfWidgetFormTextarea(),
      'duration'            => new sfWidgetFormInputText(),
      'publish_time'        => new sfWidgetFormDateTime(),
      'create_time'         => new sfWidgetFormDateTime(),
      'modify_time'         => new sfWidgetFormDateTime(),
      'snapshot_big'        => new sfWidgetFormTextarea(),
      'snapshot_small'      => new sfWidgetFormTextarea(),
      'hit_i'               => new sfWidgetFormInputText(),
      'hit_mask_i'          => new sfWidgetFormInputText(),
      'status_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Status'), 'add_empty' => true)),
      'catalog_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog'), 'add_empty' => true)),
      'sub_catalog_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog_2'), 'add_empty' => true)),
      'keyword'             => new sfWidgetFormTextarea(),
      'brief'               => new sfWidgetFormTextarea(),
      'member_level_i'      => new sfWidgetFormInputText(),
      'content_type_i'      => new sfWidgetFormInputText(),
      'link'                => new sfWidgetFormTextarea(),
      'relate_rule'         => new sfWidgetFormInputText(),
      'video_type'          => new sfWidgetFormInputText(),
      'is_audit_b'          => new sfWidgetFormInputText(),
      'daily_hit'           => new sfWidgetFormInputText(),
      'weekly_hit'          => new sfWidgetFormInputText(),
      'monthly_hit'         => new sfWidgetFormInputText(),
      'prim_video_group_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Videogroup'), 'add_empty' => true)),
      'order_i'             => new sfWidgetFormInputText(),
      'system_user_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Systemuser'), 'add_empty' => true)),
      'is_header_b'         => new sfWidgetFormInputText(),
      'is_recommend_b'      => new sfWidgetFormInputText(),
      'is_on_top_b'         => new sfWidgetFormInputText(),
      'is_focus_b'          => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'video_id'            => new sfValidatorChoice(array('choices' => array($this->getObject()->get('video_id')), 'empty_value' => $this->getObject()->get('video_id'), 'required' => false)),
      'title'               => new sfValidatorString(array('required' => false)),
      'artist'              => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'source'              => new sfValidatorString(array('required' => false)),
      'tag'                 => new sfValidatorString(array('required' => false)),
      'duration'            => new sfValidatorString(array('max_length' => 16, 'required' => false)),
      'publish_time'        => new sfValidatorDateTime(array('required' => false)),
      'create_time'         => new sfValidatorDateTime(array('required' => false)),
      'modify_time'         => new sfValidatorDateTime(array('required' => false)),
      'snapshot_big'        => new sfValidatorString(array('required' => false)),
      'snapshot_small'      => new sfValidatorString(array('required' => false)),
      'hit_i'               => new sfValidatorInteger(array('required' => false)),
      'hit_mask_i'          => new sfValidatorInteger(array('required' => false)),
      'status_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Status'), 'required' => false)),
      'catalog_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog'), 'required' => false)),
      'sub_catalog_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog_2'), 'required' => false)),
      'keyword'             => new sfValidatorString(array('required' => false)),
      'brief'               => new sfValidatorString(array('required' => false)),
      'member_level_i'      => new sfValidatorInteger(array('required' => false)),
      'content_type_i'      => new sfValidatorInteger(array('required' => false)),
      'link'                => new sfValidatorString(array('required' => false)),
      'relate_rule'         => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'video_type'          => new sfValidatorInteger(array('required' => false)),
      'is_audit_b'          => new sfValidatorInteger(array('required' => false)),
      'daily_hit'           => new sfValidatorInteger(array('required' => false)),
      'weekly_hit'          => new sfValidatorInteger(array('required' => false)),
      'monthly_hit'         => new sfValidatorInteger(array('required' => false)),
      'prim_video_group_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Videogroup'), 'required' => false)),
      'order_i'             => new sfValidatorInteger(array('required' => false)),
      'system_user_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Systemuser'), 'required' => false)),
      'is_header_b'         => new sfValidatorInteger(array('required' => false)),
      'is_recommend_b'      => new sfValidatorInteger(array('required' => false)),
      'is_on_top_b'         => new sfValidatorInteger(array('required' => false)),
      'is_focus_b'          => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('video[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Video';
  }

}
